home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Document.h
-
- Contains: An abstract base class for a document.
- (NOTE: It isn’t finished yet!)
-
- Written by: Dave Falkenburg
-
- Copyright: © 1994-95 by Dave Falkenburg, all rights reserved.
-
- Change History (most recent first):
-
- <1> 1/24/95 DRF First checked in.
- */
-
- #ifndef _SPROCKET_DOCUMENT_
- #define _SPROCKET_DOCUMENT_
-
- #include <Files.h>
- #include <OCEStandardMail.h>
- #include "MenuBar.h"
-
- class TDocument
- {
- protected:
- // TDocument cannot be directly instantiated, you must override it
- TDocument(LetterDescriptor * theContainer = NULL);
-
- public:
- virtual ~TDocument();
-
- // ---------------- METHODS WHICH MUST BE OVERRIDDEN ---------------
-
- // Document specific methods which must be overridden.
-
- virtual StringPtr GetDocumentKind(void) = 0;
-
-
- // ---------------- METHODS WHICH MAY BE OVERRIDDEN ----------------
-
- // Menu command handler: You override this method to handle any
- // content-specific commands. Call through this inherited method
- // for handling default things like closing, saving, and printing.
-
- virtual Boolean DoMenuCommand(MenuCommandID theCommand);
-
- // Some default actions we can perform on the document
-
- virtual Boolean Close(Boolean quitting);
- virtual OSErr Save(void); /* = 0 */
- virtual OSErr SaveAs(void); /* = 0 */
- virtual OSErr Revert(void); /* = 0 */
- virtual void PageSetup(Boolean useCustomPageSetup);
- virtual void Print(Boolean usePrintJobDialog);
-
- virtual StringPtr GetDocumentName(void);
-
- void BringDocumentToFront();
-
- // An internal utility function used by Close()
-
- enum CloseResult
- {
- kSaveDocument = 1,
- kCancelCloseDocument = 2,
- kDontSaveDocument = 3
- };
-
- CloseResult CloseDialog(Boolean quitting);
-
- protected:
-
- FSSpec fBackingFile;
- short fBackingFileRef;
- FSSpec fTemporaryFile;
- short fTemporaryFileRef;
-
- Boolean fNeedsSave;
- Boolean fHasBeenSaved;
- Boolean fHasNewEditions;
-
-
- public:
- static Boolean CloseAllDocuments();
-
- private:
- static TDynamicArray fgActiveDocuments;
- };
-
- #endif
-